/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package beans;

import banco.ConexaoBD;
import banco.UsuarioDAO;
import java.io.Serializable;
import java.sql.SQLException;
import javax.enterprise.context.SessionScoped;
import javax.faces.bean.ManagedBean;

/**
 *
 * @author Joao
 */
@ManagedBean(name = "searchProf")
@SessionScoped
public class PesquisaProfessor implements Serializable {

    private static  Professor resultados[] = new Professor[10];
    private Professor prof[] = new Professor[10];
    private static final long serialVersionUID = 1L;
    private String nome, opcao;
    
    private String nomes[] = new String[10];
    
    UsuarioDAO user = new UsuarioDAO(ConexaoBD.getConexaoBD());
 
    public PesquisaProfessor(){
        prof = null;
    }
    
    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getOpcao() {
        return opcao;
    }

    public void setOpcao(String opcao) {
        this.opcao = opcao;
    }

    public Professor[] getProf() {
        return prof;
    }

    public void setProf(Professor[] prof) {
        this.prof = prof;
    }
   
    public void setProfessor(Professor professor) {

        resultados[1] = professor;
    }

    public void procuraProfessor() throws SQLException {        
        prof = user.getProfessor(nome, opcao);

       // System.out.println("Cargo 1 " + prof[0].getAdmissao());
      //  System.out.println("Cargo 2 " + prof[1].getAdmissao());
    }

    public Professor[] getOrderList() {

        return resultados;

    }
}
